%% 参数设置
function [time, Phi] = main_WAIA(I, iters, W)
    addpaths;
    F = length(I);
%     epslion = 0;
    iter_Delta = zeros(1,F);
    for f = 1:F
        iter_Delta(f) = mod((f-1),F)*pi*2/F;
    end
    tic;
    Delta = 0;
    for i = 1:iters
        [A, B, Phi] = WAIA_step1(I, iter_Delta, W);
        iter_Delta = AIA_step2(I,Phi);
        epslion1 = Delta - Delta(1);
        epslion2 = iter_Delta - iter_Delta(1);
%         fprintf("epslion-->%d \n", sum(epslion(:)));
        if abs(epslion1 - epslion2) < 1e-4
            break;
        end
        Delta = iter_Delta;
%         disp(iter_Delta);
        fprintf("迭代次数--->%d \n",i);
    end
    time = toc;
end


function addpaths
    addpath(genpath('..\AIA'));
end

